package com.nelson.musicplayer.manager

import androidx.fragment.app.Fragment
import com.nelson.musicplayer.R
import com.nelson.musicplayer.business.home.HomeFragment
import com.nelson.musicplayer.business.mv.MvFragment
import com.nelson.musicplayer.business.vbang.VBangFragment
import com.nelson.musicplayer.business.yuedan.YueDanFragment

/**
 * @author nelson
 * @since 2020-07-25
 */
object FragmentManager {
    private val homeFragment by lazy { HomeFragment() }
    private val mvFragment by lazy { MvFragment() }
    private val vBangFragment by lazy { VBangFragment() }
    private val yueDanFragment by lazy { YueDanFragment() }

    fun getFragment(tableId: Int): Fragment? {
        return when (tableId) {
            R.id.tab_home -> homeFragment
            R.id.tab_mv -> mvFragment
            R.id.tab_vbang -> vBangFragment
            R.id.tab_yuedan -> yueDanFragment
            else -> null
        }
    }
}